package com.example.thridhero.broadcastbestpractice;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import java.sql.SQLOutput;

public class MainActivity extends BaseActivity {

    private Button loginbtn;
    private EditText userName;
    private EditText password;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        loginbtn = (Button) findViewById(R.id.loginId);
        userName = (EditText) findViewById(R.id.userName);
        password = (EditText) findViewById(R.id.password);


        loginbtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String userNames = userName.getText().toString();
                String passwords = password.getText().toString();

                if(userNames.equals("admin") && passwords.equals("123456")){
                    IndexActivity.onActionStart(MainActivity.this);
                }else{
                    Toast.makeText(MainActivity.this,"账号或密码错误",Toast.LENGTH_SHORT).show();
                }
            }
        });
    }


}
